const {injectBabelPlugin} = require('react-app-rewired');
const rewireLessWithModule = require('react-app-rewire-less-with-modules')

var ProgressBarPlugin = require('progress-bar-webpack-plugin');

module.exports = function override(config, env) {
    config = injectBabelPlugin(
        ['import', {libraryName: 'antd', libraryDirectory: 'es', style: true}], config);

    config.plugins.push(new ProgressBarPlugin({
        format: '[:total/:current] :msg [:bar] :percent  (:elapsed seconds)',
        clear: false
    }))

    config = rewireLessWithModule(config, env, {
        javascriptEnabled: true,
        modifyVars: {
            '@icon-url': '"~antd-iconfont/iconfont"',
        },
    })

    return config;
};